package com.jlf.starter.advice.conf;

import com.jlf.starter.advice.ExceptionAdvice;
import com.jlf.starter.advice.InputAdvice;
import com.jlf.starter.advice.OutputAdvice;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 自动配置
 *
 * @author wujr
 * 2023/7/13
 * @version 1.0
 * 【变更历史】
 * [wujr 2023/7/13 1.0 新增]
 */
@Slf4j
@Configuration
@EnableConfigurationProperties(AdviceProperties.class)
public class AdviceAutoConfiguration {
    @Autowired
    private AdviceProperties adviceProperties;

    @Bean
    public ExceptionAdvice exceptionAdvice(){
        return new ExceptionAdvice(adviceProperties);
    }

    @Bean
    public InputAdvice inputAdvice(){
        return new InputAdvice();
    }
    @Bean
    public OutputAdvice outputAdvice(){
        return new OutputAdvice();
    }
}
